
def format_sse(data: str) -> str:
    # Escape any special characters in the data
    data = data.replace("\n", "\\n")

    # Format the SSE event
    msg = f"{data}\n\n"

    return msg